Fixes to Tornado application (mostly cookies handling)