remove empty for loop and leaked i var