reuse magic cookie, improve errors