finally fixed the crash