fix bug in GP prepare