got rid of infinite loop