fixed two uninitialised memory bugs