fixed from_foreign_model and added test