fixed bug with json generation