Fix database loader and tests