fix the logical condition