fixed the crash bug