fixed uninitialised memory issues