Function in pg_value_functions.php repaired