Fixed a bug: the optimization would delete memory being used by the prediciton of the GP.