fix bug with deleting joins