This is a backport of CppNix PR 10299 Fixes #557 Change-Id: I848e8c5af4bde09afba053a5911fbbd54004fbb8