added version script. fixed minor scoping issue