fix json response
mostly works, but buggy and crappy