Fix bug where event was firing before the value changed