Fixes a number of issues with the dart2js build process.