Fixes for loop