encoding type checking added