Fixed variable initialization bugs