Fix logic bug introduced in last commit