Fixed potential bug with index js