fix usage of uninitialised variables that could lead to crashes
more fixes