Added failsafe when database is inaccessible