Extract test bugfix from Hafiz's PR

Including the slash puts the file into the root directory which is inappropriate and may result in permissions issues.