Fixed bugs and malformed JSON