fixed bug and imporved lang detection interface