add some more protection against errors during parsing