fixed: crash upon exit