Fix use of uninitialized variable bug