FamilyInstace.ByCurve

Family instace by curve returns null 50% of the time. sometimes it will run and other times it wont. Any ideas?

I figured out that if i place the family anywhere in the project it will work. like this. but why do i have to place the family first???