Fix minor parsing bugs, many tests