Self cast while targeting someone macro

I have the following macro that works for everything except for self casting modifier (which is alt via interface panel) while I have an active target (all it does is either cast shadow meld on friendly or does mindflay on enemy. It will only self cast Shadow mend if dont have an active target.

#showcooldown
#showtooltip
/cast [mod:shift, @focus, Shadow Mend] [@mouseover, help, nodead] Shadow Mend; [@mouseover, harm, nodead][@target, harm, nodead]Smite; Shadow Mend

#showtooltip
/cast [mod:shift,@focus,help,nodead] [@mouseover,help,nodead] Shadow Mend; [@mouseover,harm,nodead] [harm] Smite; Shadow Mend