cleanup
fix NotNull assertion on exit