prevent NoMethodError: undefined method [] for nil:NilClass if empty response