Correction to DirectSQL method

It could cause GPFs, now fixed