correctly remove characters for filename

Follow up of #26. I've forgotten to fix character removal for filenames. 

This PR fixes it + test case