fixed issue with NoneType Exception