Fix logs in loop