Fix null reference bug in serializer

Fixed a small bug in the serializer which was causing some errors not to be logged by Elmah