fix unitialized value $_ in length bug