timob-12857: fix edge case crashes
Merge pull request #86 from hieupham007/timob-12857

timob-12857: fix edge case crashes