check hasOwnProperty before restoring proto