failed connections to database test and bugfix