Revert "got rid of non-thread-safe non-termination hack"

This reverts commit 1491e45b5b816689273668af1086180ae675a937.
minor refactor