Fixed some issues in g and learn