fix setCookie
improve getBaseUrl