little better method of setting the payload length