trying to fix infinite loop still