Adding error case for serialization.