fixed serializatoin of errors