Fix nil exceptions