Make sure variable is set before unsetting