Fix the build

Recent modifications to ol3 broke the build. This PR makes a number of build-related changes to fix the problems.

Please review and merge.