hack-ish fix for infinite loop bug