Resolved critical bugs from scrutinizer
Merge pull request #23 from laf/issue-92

Resolved critical bugs from scrutinizer