Code enhancements mem leaks and uninitialized byte