big10p #1 Your problem is the PositionEntity command. ent1 and ent2 are only defined when the If condition/s are satisfied. When the If condition/s aren't satified, ent1 and/or ent2 won't get defined.