fixed castOk and started substitute