add data validation before parsing