fixing sdat write if statement in PreInitialize