Fix for #5247

I'm amazed Byond does not go crazy when removing element from the list you're iterating over.