Fixing bug with uninitialized memory