Improve path handling for resources