Clean up typecasting. Also support date json