Fixes an infinite loop.