Fix broken setOption & add unit test

setOption is not working: `var keys = keys(arg0)` overwrites the keys function while trying to call it.

This pull request fixes it and add corresponding unit test.