BUG: previous_state_change

PROBLEM: previous_state_change

Hello, I’m having some trouble to calculate downtimes and uptimes because of some Runtime Attributes.
When we go from a UP state to a DOWN state, the previous_state_change should be the last time a UP state was checked right?
But what is happening is that the previous_state_change is coming with the same data that last_state_change.

Here are some pictures of the mismatch of data:

And here’s the code part where this infos are setted in object NotificationCommand:
# info
“–hostname” = “$host.display_name$”
“–service” = “PING”
“–status” = “$host.state$”
“–previous_state_change” = “$host.previous_state_change$”
“–last_state_change” = “$host.last_state_change$”

Does anyone have a clue of what is going wrong or how should be done? Thank you guys.