Fixed cookie checking, loading from localstorage