fix memory leak in register_variable_in_vm functions

the variable name being passed by copy to Database::register_variable_in_vm, will be destroyed after the function execution (its scope is limited to the function block). I changed the functions signature to accept const references of the variable names, that way the variable won't be copied inside the function and its scope is the scope of the block containing the function call.
I've tested the fix, all tests passed successefully