fixed bug of incorrect if condition.