How to reduce the number of 'unknown target' bars
'Unknown target' bars are bars that get added when FX is not sure about what unit token (e.g. "target", "focus" or "pettarget") a spell was cast on. They get added with the right unit and spell names, but aren't assigned a real unique unit id (GUID) yet.

The Casting module is very old and currently built to use a unit token to figure out certain things about the unit you are GOING TO cast on, just before actually doing it. I will not go into more details about why, but it's mostly because of how the wow interface used to work before TBC. Something like this was needed so you can target another unit while still casting on a previous one AND still have a bar pop up under all circumstances. This way you would always see if the spell was cast successfully or if it had failed.

But when is FX uncertain about what unit token was cast on?
It happens when two or more unit tokens that are available for you to cast spells on (e.g. through macros) point to two different units with the same name. Let's say you're fighting two mobs with the same names, one is targeted by your pet, and the other one is targeted by you. Spells you cast on that unit will initially be added with an 'unknown target'.

When do bars that are cast on an 'unknown target' get removed?
At the moment you select a different target, mouse over another unit etc. FX looks if a bar with an 'unknown target' matches any of the debuffs on this unit (by looking at the spell name, caster and time remaining). If it's a match the 'unknown target' bar gets removed for a proper one. This correction will happen nearly instantly most of the time, but it does need to get a look at the proper target somehow. In the previous example the 'unknown bar' would get fixed instantly in you were still targeting that unit at the time your spell debuff was visible on the target.

What settings can I change to prevent 'unknown target' bars being created/shown?
Under the 'Units' options of the Spell Timer you can now disable the showing of 'unknown target' bars completely.
There is now also an Advanced option for the Casting module called 'Additional unit tokens' that lets you specify what unit tokens you use when casting your spells. The less tokens you have here, the less chance that FX will not be certain about the one you were casting on. But you have to be sure not to use any other tokens than those you have added here.

Known issues
Note: since 4.0.1 debuff durations may vary based on for much time was left untill the next tick when the debuff was refreshed, therefore 'unknown target' bars may now get removed too soon. It's also possible that FX's estimate of some spell durations is wrong because the class modules are not complete yet, in which case 'unknown target' bars may not get removed at all.
Hopefully I can safely replace this system without sacrificing any functionality in the near future.