Added check in reset_running_commands and cleaned some tests.