fixed database loading bug. sub optimal solution for database. fix in future