port from 2.11.1 branch