Fix illegal use of $_COOKIE issue

Fixes #4