bring fixes back to master

Please review