Fixed bugs in deserializing json