Fix currentLength assignment