bugfix related to how state is passed to client scripts