Use Object.getOwnPropertyNames when possible
Fixes #3