Bug fix for undefined cookie