Small fixes

Don't merge yet. Still testing.


Small code fixes.
- Unfold loop.
- Initialize ivars which didn't initialized.