Fix undefined method `ref' for nil:NilClass for bad accept headers