diff --git a/entityreference.module b/entityreference.module
index bac359b..9e3f2ac 100644
--- a/entityreference.module
+++ b/entityreference.module
@@ -100,7 +100,7 @@ function entityreference_get_selection_handler($field, $instance = NULL, EntityI
   // Check if the entity type does exist and has a base table.
   $entity_info = entity_get_info($target_entity_type);
   if (empty($entity_info['base table'])) {
-    return new Drupal\entityreference\Plugin\Type\Selection\SelectionBroken($field, $instance);
+    return new SelectionBroken($field, $instance);
   }
 
   $plugin = entityreference_get_plugin_manager('selection')->getDefinition($field['settings']['handler']);
@@ -128,7 +128,7 @@ function entityreference_get_selection_handler($field, $instance = NULL, EntityI
   }
 
   // Class does not exist.
-  return Drupal\entityreference\Plugin\Type\Selection\SelectionBroken($field, $instance, $entity);
+  return SelectionBroken($field, $instance, $entity);
 }
 
 /**
@@ -404,7 +404,7 @@ function entityreference_autocomplete_callback($type, $field_name, $entity_type,
   $entity = NULL;
 
   if ($entity_id !== 'NULL') {
-    $entity = entity_load($entity_type, $entity_id);
+    $entity = \Drupal::service('entity_type.manager')->getStorage($entity_type)->load($entity_id);
     // TODO: Improve when we have entity_access().
     $entity_access = $target_type == 'node' ? node_access('view', $entity) : TRUE;
     if (!$entity || !$entity_access) {
diff --git a/lib/Drupal/entityreference/Plugin/Type/Selection/SelectionEntityTypeUser.php b/lib/Drupal/entityreference/Plugin/Type/Selection/SelectionEntityTypeUser.php
index 88eee5e..59c32ec 100644
--- a/lib/Drupal/entityreference/Plugin/Type/Selection/SelectionEntityTypeUser.php
+++ b/lib/Drupal/entityreference/Plugin/Type/Selection/SelectionEntityTypeUser.php
@@ -60,7 +60,7 @@ class SelectionEntityTypeUser extends SelectionBase {
           $value_part->condition('anonymous_name', $condition['value'], $condition['operator']);
           $value_part->compile(Database::getConnection(), $query);
           $or->condition(db_and()
-            ->where(str_replace('anonymous_name', ':anonymous_name', (string) $value_part), $value_part->arguments() + array(':anonymous_name' => user_format_name(user_load(0))))
+            ->where(str_replace('anonymous_name', ':anonymous_name', (string) $value_part), $value_part->arguments() + array(':anonymous_name' => user_format_name(\Drupal::service('entity_type.manager')->getStorage('user')->load(0))))
             ->condition('users.uid', 0)
           );
           $query->condition($or);
diff --git a/lib/Drupal/entityreference/Tests/entityReferenceSelectionAccessTest.php b/lib/Drupal/entityreference/Tests/entityReferenceSelectionAccessTest.php
index b946929..05f42b3 100644
--- a/lib/Drupal/entityreference/Tests/entityReferenceSelectionAccessTest.php
+++ b/lib/Drupal/entityreference/Tests/entityReferenceSelectionAccessTest.php
@@ -84,7 +84,7 @@ class entityReferenceSelectionAccessTest extends WebTestBase {
     $nodes = array();
     $node_labels = array();
     foreach ($node_values as $key => $values) {
-      $node = entity_create('node', $values);
+      $node = \Drupal::service('entity_type.manager')->getStorage('node')->create($values);
       $node->save();
       $nodes[$key] = $node;
       $node_labels[$key] = check_plain($node->label());
@@ -184,8 +184,8 @@ class entityReferenceSelectionAccessTest extends WebTestBase {
 
     // Build a set of test data.
     $user_values = array(
-      'anonymous' => user_load(0),
-      'admin' => user_load(1),
+      'anonymous' => \Drupal::service('entity_type.manager')->getStorage('user')->load(0),
+      'admin' => \Drupal::service('entity_type.manager')->getStorage('user')->load(1),
       'non_admin' => array(
         'name' => 'non_admin <&>',
         'mail' => 'non_admin@example.com',
@@ -208,7 +208,7 @@ class entityReferenceSelectionAccessTest extends WebTestBase {
     $user_labels = array();
     foreach ($user_values as $key => $values) {
       if (is_array($values)) {
-        $account = entity_create('user', $values);
+        $account = \Drupal::service('entity_type.manager')->getStorage('user')->create($values);
         $account->save();
       }
       else {
@@ -325,7 +325,7 @@ class entityReferenceSelectionAccessTest extends WebTestBase {
     );
     $nodes = array();
     foreach ($node_values as $key => $values) {
-      $node = entity_create('node', $values);
+      $node = \Drupal::service('entity_type.manager')->getStorage('node')->create($values);
       $node->save();
       $nodes[$key] = $node;
     }
@@ -363,7 +363,7 @@ class entityReferenceSelectionAccessTest extends WebTestBase {
     $comments = array();
     $comment_labels = array();
     foreach ($comment_values as $key => $values) {
-      $comment = entity_create('comment', $values);
+      $comment = \Drupal::service('entity_type.manager')->getStorage('comment')->create($values);
       $comment->save();
       $comments[$key] = $comment;
       $comment_labels[$key] = check_plain($comment->label());
