Safeguard against nil or empty target

Added code to safeguard against a nil or empty target string.  In the case of a nil or empty target string, both commands are inhibited.