wrap load-from-cookie in a function