CastAbilityontarget and onposition not working for dummy unit? [SOLVED]

edited June 2016 in Questions
local spawnloc = target
                    if target_type == DOTA_ABILITY_BEHAVIOR_UNIT_TARGET then
                        spawnloc = target:GetAbsOrigin()
                    end
                    local echoUnit = CreateUnitByName("npc_dummy_unit", spawnloc, false, caster, caster, caster:GetTeamNumber())
                    echoUnit:AddAbility(echo:GetName())
                    echoUnit:AddNewModifier(echoUnit, nil, 'modifier_invulnerable', {})
                    if caster:HasModifier('modifier_item_ultimate_scepter') then
                                                    echoUnit:AddNewModifier(echoUnit, nil, 'modifier_item_ultimate_scepter', {
                                                        bonus_all_stats = 0,
                                                        bonus_health = 0,
                                                        bonus_mana = 0
                                                    })
                    end
                    echoUnit:SetMana(echo:GetManaCost(-1)+1)
                    local echoAb = echoUnit:FindAbilityByName(echo:GetName())
                    if echoAb then
                        echoAb:SetLevel(echo:GetLevel())
                        if target_type == DOTA_ABILITY_BEHAVIOR_POINT then
                            echoUnit:CastAbilityOnPosition(echoUnit:GetAbsOrigin(), echoAb, player)
                            ability:StartCooldown(cooldown)
                        elseif target_type == DOTA_ABILITY_BEHAVIOR_UNIT_TARGET then
                            echoUnit:CastAbilityOnTarget(target, echoAb,  player)
                            ability:StartCooldown(cooldown)
                        end
                    end
                    echoUnit:SetControllableByPlayer( player, false)
                    Timers:CreateTimer(echo:GetChannelTime(), function() echoUnit:RemoveSelf() end)

while the dummy unit is alive i can see the ability is castable (it has mana, ability is off cooldown and the target is in cast range) but the dummy unit still won't cast the ability; when i replace the castabilityontarget by the hero that owns the dummy it does work however; does anyone have any idea why? changing playerid to -1 didn't seem to help either fixed it by using

echoUnit:SetCursorPosition(target)
echoAb:CastAbility()
echoAb:SetChanneling(true)