Added more error handling to deal with no database being loaded