add whenever, but it don't work. Find bugs in state