Fix i variable leaks