Fix require handling for folders and modules.