Fixing tests after PR #100

Unfortunately PR #100 introduced some bugs - here is a fix.
Runned all json-related tests - all are passing now.