Fix issues with cmd module and states on Windows.