fix nil exception

for some reason `{}.delete(:object)` returns `nil` but the code was
expecting it to return `nil` - maybe this is new in ruby 2.0?

this approach should work with all modern versions of ruby.