fixed the way json was written