fix calculation of auth code