Use os.path.basename instead of split