Fixes mostly NULL-ptr deref.

Revealed by clangs static code analyzer.
Temporary dangling pointer fix between WireItem/Wire, closes #111.

Opens #112.