Simple fix to avoid the infinite loop