Fix defects
Fix defects
Merge pull request #2 from rdyachenko/master

bug fixes