Improved PersistenceAgent.as_module().