fixed connection to database