Fixing some state flow part 1