fixed bug in var-GP function