fix final state in if statement