fix to prevent infinite loop