Fixed bug in type checking.