improved gfist and gdist