Solved problem with glf function