Make sure for new packages get a unique 'name'

This fixes #117.

The problem is that a "new" package could have a 'name' attributes that's already taken. By using `gen_new_name()` we can be sure the name is valid for this instance. The conditional is only there to ensure that the existing 'name' is used if possible, but maybe that's not even necessary.