diff --git a/readonlymode.module b/readonlymode.module
index be434cc..61b27b3 100755
--- a/readonlymode.module
+++ b/readonlymode.module
@@ -102,7 +102,7 @@ function readonlymode_settings_form_validate(array &$form, FormStateInterface $f
   if ($path = $values['url']) {
     $item = menu_get_item($path);
     if (!$item || !$item['access']) {
-      $form_state->setError(array('url'), t('The path %link_path is either invalid or you do not have access to it.', array('%link_path' => $path)));
+      $form_state->setErrorByName('url', t('The path %link_path is either invalid or you do not have access to it.', array('%link_path' => $path)));
     }
   }
 }
@@ -184,7 +184,7 @@ function readonlymode_check_form_validate(array &$form, FormStateInterface $form
   // Check for Read Only Mode, whether we are allowed this form,
   if (!_readonlymode_form_check($form, $form['form_id']['#value'], TRUE)) {
     $settings = \Drupal::config('readonlymode.settings');
-    $form_state->setError([], t($settings->get('messages.not_saved'), array(
+    $form_state->setErrorByName('submit', t($settings->get('messages.not_saved'), array(
       '@site' => \Drupal::config('system.site')->get('name'),
     )));
   }
