ternopil: boundaries check