I think what is happening is that PHP protects variables that are global (as they appear to be in this case) from being modified by functions (as you're trying to do in this case).
Try:
<?
function fix(&$v1,&$v2,&$v3,&$v4,&$v5)
{
#stuff
}
fix($var1,$var2,$var3,$var4,$var5);
?>
this should pass the changed values from your function back into your file, "main.php"