remove unused local vars
simplify logical statement
Merge pull request #4007 from shikolay/master

Micro cleanups