Fixed some broken logic.