Fixes for Armen's mega commit.