Various fixes relating to character parsing