Fix refactoring bug; make command-state non-dynamic
(since it should be global and not thread-local).