fixed error with connecting to db