fixed #428

NPEs on multi-threaded em.clear() calls
Merge pull request #430 from bsideup/bugfix-428

fixed #428