fixing JSON conversion functions