Improve handling of relative paths in modules