Fix further issues with loops