Fixed initialisation and memory access errors for Windows