use lastState from db