Added respond_to checking prior to valid_encoding