Fix bug in learning