Fix server bug and return JSON