Make output parsing a bit more robust