main cycle fix