fix test expected string and ensure that command string has valid format