Fix serialization error in API