Many fixes and improvements before 2.7

#630, #666, #762, #818, #775, #628, #431, #805, #779, #812, #829, #832,
#836, #839, #834, #843