fixed prefered_state variable
Merge remote-tracking branch 'tom/master'