Minor fixes in learning.py