if statement bug