fixed bug with deleting relations