hasOwnProperty checks to fix bug with falsy values