MV YEP Turn Order custom backgrounds

Hi.
I'm trying to replace square default background of YEP Turn Order with my custom, loaded from images. I've changed code for drawBorder class to be like this:
JavaScript:
Window_TurnOrderIcon.prototype.drawBorder = function() {
  if (this.battler().isActor()) {
    var bitmap = ImageManager.loadBitmap("img/system/", "turn_order");
    this.contents.blt(bitmap, 0, 0, 55, 55, 0, 0);
  }
  if (this.battler().isEnemy()) {
    var bitmap2 = ImageManager.loadBitmap("img/system/", "turn_order_enemy");
    this.contents.blt(bitmap2, 0, 0, 55, 55, 0, 0);
  }
  return;
};
Background for actors are displayed correctly. The issue is with background for enemies. For some reason they don't display on start of combat, only after one of battlers die. It looks like this is displayed during some refresh.
The enemy icon doesn't display at all at the start of combat now? Or it displays with the old background until something dies?

Reading through the plugin, it looks like those parameters are first set in the processTODNotetags1 function, starting at line 295. So try putting the code you made into that section as well.
Icons for enemies display just fine. It's the background, that loads only after one battler dies. So it's just plain icon in the beginning, then, after one battler (actor or enemy, doesn't matter) dies, it starts to show background for enemies as well. My custom backround.

As for line 295, this function is for reading properties into battler. Tried to assign background there like this.background = ImageManager.loadBitmap("img/system/", "turn_order_enemy"); and then only load it in drawBorder like this.contents.blt(this.battler().background, 0, 0, 55, 55, 0, 0); but I've been getting errors.

What could possibly cause this effect with no border for enemies? It loads perfectly for actors. What's so different with drawing enemies?

edit:
I've added same chunk of code to Window_TurnOrderIcon.prototype.setup, but it changed nothing.
I've edited slightly the code. Now it looks like this:
JavaScript:
Window_TurnOrderIcon.prototype.setup = function() {
...
  if (this.battler().isActor()) {
    this.backgroundImage = ImageManager.loadBitmap("img/system/", "turn_order");
  }
  else if (this.battler().isEnemy()) {
    this.backgroundImage = ImageManager.loadBitmap("img/system/", "turn_order_enemy");
  }
}

...

Window_TurnOrderIcon.prototype.drawBorder = function() {
  this.contents.blt(this.backgroundImage, 0, 0, 55, 55, 0, 0);
  return;
};

But it still loads only background for actors. And for tests I've got rid of the if statements, so setup had this line added only: this.backgroundImage = ImageManager.loadBitmap("img/system/", "turn_order_enemy"); and it should load same background for both actors and enemies. For actors it did load, but for enemies not. What is wrong with this?
Omg, I've fixed it. It had not enough time to load image, changing if statement in Window_TurnOrderIcon.prototype.waitUntilLoaded to if (this._image.width <= 0 || this.backgroundImage.width <= 0) did the trick.

Original thread: https://forums.rpgmakerweb.com/threads/yep-turn-order-custom-backgrounds.137995/