Fix validation and ensure tests pass