fix for threaded version (locks)