Override Profiles Controller Issue

Hi All,

If i tried to override the "update" mode in "profiles" controller i write the following inside my custom add-on (profiles.pre.php) file:

if ($_SERVER['REQUEST_METHOD'] == 'POST') {

if ($mode == 'update') {

$new_controller = 'profiles';
$new_mode = 'custom_update';

fn_dispatch($new_controller, $new_mode);
exit;
}
if ($mode == 'custom_update'){
//do something here
}
}
But i get the following Error
Uncaught Error: Class 'Session' not found in app\functions\fn.control.php(680) : eval()'d code on line 78

So Could anyone help me please ?

Hello!

What exactly should be done by custom update?

Best regards,