(squashed) M6 bugfixing spree

see c5681839ee for detailed history