Fixing magic cookies