Fixed a small logic bug introduced in the last commit