You need to initialize sub_state_functions somewhere.
Why are they spaced by 10 in an array?