Partial backport of #1137; Fix #1131
Unit test
Regenerated build/ files