bugfixes in core + mocktest
core: cleanup initIdentity