fix validating bugs