Fixed the crash bug