modified to use os.path.sep instead of os.sep