Avoid NPE on shutdown