Fix logic mistake