Fixed implementation of lib_json due to some test cases failing