Fix infinite loop #9