Fix a problem when multiple cookies are present, fix file reading