Fixed a crash when deallocating elements too quickly