Fixed bugs with JSONObject related to spaces