Corrected the bugs in the if implementation.