Changed from object check to loose null

hasOwnProperty only fails on null and undefined. Updated check as such