Fixed error cases
Merge pull request #4 from dbonasera/master

Fixed error cases