add max argument to the pump call to only pump length bytes