Sex ratio evolution in a variable environment