remove assert and add xor input validation