Forward port of saas-3 branch up to rev 28a27a9