fixes for loop etc