Fix uninitialized values, allocated memory