Fixed error when _ser is None

_ser can be None which leads to TypeError.