Added some null checks to prevent a rare NPE on chunk unload.