Improves filepath sanitization thanks to @rui314 once again