Fix CreateInstance bug for Windows/Linux