back ported changes from the 1.7.10 version