Fixed update and delete sql generation