Fixed bug in JSON wrapping