Tests and fixes

Adding tests for `get` and `set`.
Fixing a couple of issues found from the tests.