Backported fix for issue #128 from bndtools branch.