It should work even if the image point doesn't exist.
The formula for cursor is a bit wrong, it should be (playerHead.imagePointX("eye")+radius*cos(ang) , playerHead.imagePointY("eye")+radius*sin(ang))
Although this still doesn't explain why the result is NaN. Maybe there are some other events which can change cursor position?