Small fixes

Small code fixes.
- Unfold loop.
- Initialize ivars which didn't initialized.


Tested with unittest & flare-tests.
please use tabs