fixed a if clause bug