Fix #422 wrong "unknown module" error

This isn't the clearest possible way of fixing this, but that would involve changing the representation of imports to include modules as another layer in the map, and therefore leave a whole bunch of stuff that needs refactoring, so for now at least I suggest this.

This also adds position info to the error message that was previously missing.