Fixes for issue #6
Fixes for issue #7
Merge pull request #8 from epoberezkin/master

Fixes for issues #6 and #7