fixed issues with sql connection