fixed bug in gdist.prep