Improve performance when unloading entitiesSigned-off-by: Ross Allan <[email protected]> (commit: e68eb5d)