bring over build fixes from stable branch