improve caching of transitions and states
fix x variable in event function of top state