fixing use of un-initialized memory