fix regression on #28

We need to lock when using the cache.
remove unused imports