fix calling of prepare script function

The scope that contains inputs, outputs and friends was bound to the
function object, which is wrong when applying the function later on.
Instead, we're passing those variables as function arguments now.

Change-Id: I7ad7b6a742091fae889ed57b7c9cbceea4a2ead2
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>