Fix json serialization properly