Fixed premature initialization bug