Fixed bug in $cookie refactoring.