Pitfalls of finite state machines