you still don't prevent it from updating on the player frame when it fires for the target unit.
You can add the following in the top of your function, and it only execute for the correct unit. Another thing you should do is to remove the if(unit == 'target' or unit == 'player') part of your code.
Code:
if(self.unit ~= unit) then return end