forward-port my 1.x changes to master