fix bug: wrong condition