MV Update Sprite Character Properly

Hello,
I am writing a script that draws a gradient bar at the top of the sprite on the map - pretty much what `Window_Base.prototype.drawGauge` does only with the appropriate tweaks for Sprite_Character..
I call the function that draws the bar on `Sprite_Character.prototype.update`.

The problem I'm experiencing is that the bar only shows when the character is facing down. Whenever the direction is changed, the bar is gone.
I tried searching the code of `Sprite_Character` but couldn't find the reason this happens.
Also, when debugging I couldn't see the values change in any way that should affect the drawing (I use anchor.x and anchor.y of the Sprite_Character and the values don't change when the direction is different).

Does anyone have an idea what causes this and how to fix it?
Thanks in advance.
It'd be far easier if you posted your code here than second guessing what you might have done there.
As I mentioned it's copy-paste of what's done in Window_Base.prototype.drawGauge, I just used the bitmap of the sprite instead of contents.
I call this in Sprite_Character.prototype.update.

JavaScript:
Sprite_Character.prototype.drawHpBar = function() {
    const x = this.anchor.x;
    const y = this.anchor.y - 31;
    const width = this.bitmap.width;
    const rate = this._character._hp / this._character._maxHp;
    const color1 = this.getColor(10);
    const color2 = this.getColor(2);
    const fillW = Math.floor(width * rate);
    const gaugeY = y + 36 - 8;
    this.bitmap.fillRect(x, gaugeY, width, 6, this.getColor(19));
    this.bitmap.gradientFillRect(x, gaugeY, fillW, 6, color1, color2);
}

The fact that it works in certain cases makes me wonder if I need to call it somewhere else...
Never mind. Figured it out on my own.
Thread closed

Would have been nice if you'd said what the solution was, so this thread might be helpful to anyone else trying to do the same thing down the track.

Original thread: https://forums.rpgmakerweb.com/threads/update-sprite-character-properly.154865/