fixed database loader to use cache directory during tests