Fix a DOS possibility, and a crash