Correct few issues with sql request during return.