Merge pull request #10 from aggrolite/master

make code a bit more defensive