fix for 'NoneType' error