fix for NoneType crash