fix low level memory corruption caused by poor initialisation of tmp storage