Added Serial == null handling

To avoid errors reached by trying to write to a null port