Fix crash in single-threaded mode