Fixed incorrect handling of timestamps in _to_datetime()