fix len check bug