Fix serialization of beans