adjusted the way source removal is handled to make it a bit more safe