fix bufferunderflow problem