Shouldn't this be `return nil unless x.kind_of? Hash`?