Fixed some code in base loop.