Fix for issue #115. Add more robust string parsing.