integrate latest changes from branch 1.7