put 'curRequestSize = 0' after 'logDebug' it