diff --git a/lib/tasks/migrate_from_trac.rake b/lib/tasks/migrate_from_trac.rake
index 9e9f8d7..09ee613 100644
--- a/lib/tasks/migrate_from_trac.rake
+++ b/lib/tasks/migrate_from_trac.rake
@@ -91,7 +91,7 @@ namespace :redmine do
         # If this attribute is set a milestone has a defined target timepoint
         def due
           if read_attribute(:due) && read_attribute(:due) > 0
-            Time.at(read_attribute(:due)).to_date
+            Time.at(read_attribute(:due)/1000000.0).to_date
           else
             nil
           end
@@ -99,7 +99,7 @@ namespace :redmine do
         # This is the real timepoint at which the milestone has finished.
         def completed
           if read_attribute(:completed) && read_attribute(:completed) > 0
-            Time.at(read_attribute(:completed)).to_date
+            Time.at(read_attribute(:completed)/1000000.0).to_date
           else
             nil
           end
@@ -119,7 +119,7 @@ namespace :redmine do
         set_table_name :attachment
         set_inheritance_column :none
 
-        def time; Time.at(read_attribute(:time)) end
+        def time; Time.at(read_attribute(:time)/1000000.0) end
 
         def original_filename
           filename
@@ -161,12 +161,12 @@ namespace :redmine do
         set_inheritance_column :none
 
         # ticket changes: only migrate status changes and comments
-        has_many :changes, :class_name => "TracTicketChange", :foreign_key => :ticket
-        has_many :attachments, :class_name => "TracAttachment",
+        has_many :changes, :class_name => "TracMigrate::TracTicketChange", :foreign_key => :ticket
+        has_many :attachments, :class_name => "TracMigrate::TracAttachment",
                                :finder_sql => "SELECT DISTINCT attachment.* FROM #{TracMigrate::TracAttachment.table_name}" +
                                               " WHERE #{TracMigrate::TracAttachment.table_name}.type = 'ticket'" +
                                               ' AND #{TracMigrate::TracAttachment.table_name}.id = \'#{TracMigrate::TracAttachment.connection.quote_string(id.to_s)}\''
-        has_many :customs, :class_name => "TracTicketCustom", :foreign_key => :ticket
+        has_many :customs, :class_name => "TracMigrate::TracTicketCustom", :foreign_key => :ticket
 
         def ticket_type
           read_attribute(:type)
@@ -180,14 +180,14 @@ namespace :redmine do
           read_attribute(:description).blank? ? summary : read_attribute(:description)
         end
 
-        def time; Time.at(read_attribute(:time)) end
-        def changetime; Time.at(read_attribute(:changetime)) end
+        def time; Time.at(read_attribute(:time)/1000000.0) end
+        def changetime; Time.at(read_attribute(:changetime)/1000000.0) end
       end
 
       class TracTicketChange < ActiveRecord::Base
         set_table_name :ticket_change
 
-        def time; Time.at(read_attribute(:time)) end
+        def time; Time.at(read_attribute(:time)/1000000.0) end
       end
 
       TRAC_WIKI_PAGES = %w(InterMapTxt InterTrac InterWiki RecentChanges SandBox TracAccessibility TracAdmin TracBackup TracBrowser TracCgi TracChangeset \
@@ -202,7 +202,7 @@ namespace :redmine do
         set_table_name :wiki
         set_primary_key :name
 
-        has_many :attachments, :class_name => "TracAttachment",
+        has_many :attachments, :class_name => "TracMigrate::TracAttachment",
                                :finder_sql => "SELECT DISTINCT attachment.* FROM #{TracMigrate::TracAttachment.table_name}" +
                                       " WHERE #{TracMigrate::TracAttachment.table_name}.type = 'wiki'" +
                                       ' AND #{TracMigrate::TracAttachment.table_name}.id = \'#{TracMigrate::TracAttachment.connection.quote_string(id.to_s)}\''
@@ -212,7 +212,7 @@ namespace :redmine do
           super.select {|column| column.name.to_s != 'readonly'}
         end
 
-        def time; Time.at(read_attribute(:time)) end
+        def time; Time.at(read_attribute(:time)/1000000.0) end
       end
 
       class TracPermission < ActiveRecord::Base
@@ -487,23 +487,26 @@ namespace :redmine do
               comment_change = changeset.select {|change| change.field == 'comment'}.first
 
               n = Journal.new :notes => (comment_change ? convert_wiki_text(encode(comment_change.newvalue)) : ''),
-                              :created_on => time
+                              :created_at => time
               n.user = find_or_create_user(changeset.first.author)
               n.journalized = i
               if status_change &&
                    STATUS_MAPPING[status_change.oldvalue] &&
                    STATUS_MAPPING[status_change.newvalue] &&
                    (STATUS_MAPPING[status_change.oldvalue] != STATUS_MAPPING[status_change.newvalue])
-                n.details << JournalDetail.new(:property => 'attr',
-                                               :prop_key => 'status_id',
-                                               :old_value => STATUS_MAPPING[status_change.oldvalue].id,
-                                               :value => STATUS_MAPPING[status_change.newvalue].id)
+                n.changes.merge({
+                               'status_id' => [
+                                               STATUS_MAPPING[status_change.oldvalue].id,
+                                               STATUS_MAPPING[status_change.newvalue].id]
+                })
               end
               if resolution_change
-                n.details << JournalDetail.new(:property => 'cf',
-                                               :prop_key => custom_field_map['resolution'].id,
-                                               :old_value => resolution_change.oldvalue,
-                                               :value => resolution_change.newvalue)
+                n.changes.merge({
+                               custom_field_map['resolution'].id => [
+                                               resolution_change.oldvalue,
+                                               resolution_change.newvalue
+                               ]
+                })
               end
               n.save unless n.details.empty? && n.notes.blank?
           end