some fixes for loops and charts