fixed #428

NPEs on multi-threaded em.clear() calls