type checking in loop iterators, couple minor fixes