Fix auto-locating mask stack.

Also try a different fix for travis gdal build error.