length checking fix