making sure values are valid