validated and fixed errors