fixing a nil issue