Fix command logic