fixed errors in type checking
fixed errors in type checking