fixed conditional to avoid NoMethodErrors