The memq-related patch doesn't look quite right to me, since byte-optimize-and might be called on a form that is not 'and'. Does the attached patch fix things for you?