Added condition for mopac failure