add assertion error in serialize