more function tests, fixed a bug substituting out-of-scope assignment effects