Fix for ACT-2070: issue in optimising delete statements