fixed bug of wrong condition