fix ignoreErrors and refactor State