fixed ugly error checking
Merge branch 'fix-ugly-error-checking'
0.3.9