Added a few variable initialisations that coincidentally fix a crash bug