generate check code