fixing issue with json generation