code tweaks
fixed cookie check