enhanced error validation