fixed to_t method bugs.