tern: fix some invalid language codes on the fly