fixing json encoding