Added additional checks to database filepath