not working state update problem