fixed a cast problem in the maxlen variable