Added try-catch on validation to avoid crashing the program