finish Gray code fix issue #49