port some functions over to M4 and make them work with mjs
conversions to/from M4 and plain arrays
misc fixes and typos