Fix validation bugs