Fixed a potential endless loop