Issue refs #1677: remove debug code, fix build script