Better JSON support for time types + Some JSON bugfixes