fix to avoid infinite loop