Fix statement prerequisites and materialization