Fix 500 error when deleting a source