Fix issues found by EBN

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