Trailing slash of directories was mishandled, and incorrect derived paths were formed. Stripping the slash fixes this.