fix a null reference error