Fix a bug that cause the crash