fix gray coding example after Direction changes