implement read len code