Fixed logic bug.