fixed setindex derivation, started on for loops pruning