Fix incorrect handling of todo state change