Fix the serialization of the download task

+ small improvement of the error handing at the session creation

Signed-off-by: Nico Rutishauser <nr@hotmail.ch>