Cumulative fixes from D7 backported