Fix issues with "statechange" event being called multiple times.