Fix setting of the filename to remove
Remove incorrect use of local