Bugfix: reset state before updating data