Check if outmodules are on endpath. Fixes #4265