Fix language class detection

closes #380