Fixed a logic if/else bug.