fixes #570 Moved dbt logic to storage/dbt.h