added a nil check
Added a to_i coercion