Fixed a logic bug.