Small cleanup...
Fix issue #318: Incorrect type generation
Fix unsafe condition...
Merge pull request #319 from SlavaRa/issue318

Fix Issue #318: Incorrect type generation