wip: refactoring reference generation/plugins
TEMP - add christian's test
fix error when exiting DB