corrected type checking