Update return value, and prevent infinite loop.