Possible fix for endles loop