small fix and optimization
Merge pull request #94 from yupe/master

UPD: merge with yupe/master