Fixed errors in json creation