fixes for hanlding None types