fix for none type error