Added filter to mutable set removal to prevent crash in some situations