fixed last issue with sql being in controllers