remove duplicate loop in abstract cast checker (closes #1995)