fixed conditional logic