Fix MER#769, MER#814 and more

Worth of careful review/testing.