Add a test for handling invald strings

fixes #147