minor bug fix to avoid NoneType Exception