fix uninitialised value bugs