Fixes infinite loop