fixed issues with if statements