fix loop not running error