Added debug statements to type checking.