fix type variable handling

Return null instead of an object proxy as the later could then failed to be converted to the expected type. As the targeted type cannot be resolved, it sounds better to just return null.