Fixed small leakages / bugs in debug and learn