bugs in the if  conditional statement