improved printing of loop type checking errors