fix cond function bug