Ported some of the 1.4 fixes..