fix code for prev-lang lenght calculation