fix bugs if path doesn't exist