more careful string handling when parsing