Type checking improvements