lots of bugfixes to M4 conversion functions