Updated handler function safe calling