Fix dirty_fields when fetching from database, fixes #440