Fix hasOwnProperty for functions

Fixes #149
Add hasOwnProperty tests
Merge pull request #151 from tessel/km-hasOwnProperty

Fix hasOwnProperty and add tests