fix bug in memory issue at test (do not save trajectory, but only final sample)