MT#9561 upstream fixes from 4.1 branch

Change-Id: I2d21fbd2d1ab0f272439cd227e472da0baa98af7
(cherry picked from commit 3421de34c47d6c2b560276ae319219297a2b2dc6)