Fixed GetReference using the same generated function for different types