fix db loading logic and check the file exists before attempting to load [#163]