change getCookie method to use isEmpty