You don't need to check that a variable is set before you unset it, just unset it, it's safe.