Should fix issues with endless loops