added better error handling for connection fails

has to be tested further
brand listing and database connections fixed