Fix issues found by EBN

Authored by yurchor on Oct 7 2019, 3:25 PM.