Fixed heap-use-after-free in learner