Preparation of methyl carbamates via a modified Hofmann rearrangement