Fixed reversed if statement in checkValid() that I forgot to change after testing