dont add keys when target is missing during duplication, added 'generate missing targets', some fixes