Weird race condition in object initialisation happening