implement primary deallocation

yes, i get some ConcurrentModificationException while iterating without it.