fix exception when no database