fix to stop an infinite loop