= core: fix NPE when finishing segments, fixes #88