fixed conditional bug