More fixes for JSON compatibility