fixing crash in release mode