rewrite cookie handler
compensate for 1.3.6 changes