basic type checks on nested scopes and user defined functoins