better pathify method. fixing index.