Pulled in changes from 1.7 branch