Strip slash to workaround weird os.path.dirname behavior.