integrate latest changes from 4.7 branch