fixed the uniqueness check for by adding a not and doing the wrapping of state into node in an earlier stage