Fix deleting related from database