Add when & set hw commands, & fix a bug in filter