Cherry-picked changes from master, 7876cdd..0fb8715