Fixes #1673
Improve Fixes #1673: clear all states