Various fixes to tokenizer and parser