Hotfixes/add typecheck for scan output

To be merge after recover_state!!