Loop bug fixes tng

Should merge now.