WIP: fixed errors in LM model generation