type checking fixes