fixing crash when running with asan
Merge pull request #1509 from konstin/asan

fixing crash when running with asan