Fixed the exception catching when getting the cookie