Made CreateInstance<T>() portable