Attempt to resolve segfaults in encode_timedelta

This does not work.