Fixed converting objects into json before submission