removed redundent json_encode() call, and fixed naming typos