Added some session preservation code to the internal curl call.