Correction a en error which caused an infinite loop.