AND gate not giving correct output