some fixes and simpler json serialization