Fixed #47

Replaced occurrences of `a.hasOwnProperty(b)` with `Object.prototype.hasOwnProperty.call(a, b)` and fixed a translator bug.