gray2bin works the first time