Clang warnings, NPC-136

fix -Wtautological-compare warinig (UInt >= 0) (reported by clang)
some code cleanup