Fixed a bug with state activation.