Fixed ID resolving

There was a problem in resolving the IDs that came up in some cases
and caused illegal IDs to be generated. Now there is a proper ID
overlap detection implemented. Its slightly more time consuming,
but as the resolving is done once when the elements are created and
too long IDs slow done the event handling it does not really matter.

Also there is now a test case that validates correct ID creation.
Added some missing annotations
Added some fail-saves for adding and removing child elements