Hotfixes/add typecheck for scan output

Merge me after recover_state!!