Crazy "fix" for exception at shutdown