better 'bytesRequired' function