optimized so it doesn't loop even after update finished.

optimized so it doesn't loop even after update finished.