Fixed access to uninitialized data and attempt to double free