Fixed: NoMethodError: undefined method each for nil:NilClass