fixes infinite loop