diff --git a/forms/submission.php b/forms/submission.php
index fe9eb16fc1330b0f4d63fd3b1d46c862c7f79326..32074d4fa08f5acad9e77a3acae87187f655dac3 100644
--- a/forms/submission.php
+++ b/forms/submission.php
@@ -88,12 +88,10 @@ if ($fromform = $mform->get_data()) {
                     $data = iconv( $encode, 'UTF-8', $data );
                 }
                 $files [$name] = $data;
-            }
-            else {
+            } else {
                 if (in_array($name . '.b64', $reqfiles)) {
                     $files [$name . '.b64'] = base64_encode($data);
-                }
-                else {
+                } else {
                     $files [$name] = $data;
                 }
             }
diff --git a/grade.php b/grade.php
index 09e00f0db99d5e53fdd72c86bf3121c372082278..599d30108a31a4b36bbd6e2c1877221bffbd8436 100644
--- a/grade.php
+++ b/grade.php
@@ -39,7 +39,7 @@ if ($vpl->has_capability( VPL_GRADE_CAPABILITY )) {
     if ($userid) {
         vpl_inmediate_redirect( vpl_mod_href( 'forms/gradesubmission.php', 'id', $id, 'userid', $userid ) );
     } else {
-        vpl_inmediate_redirect( vpl_mod_href( 'views/submissionslist.php', 'id', $id ) );
+        vpl_inmediate_redirect( vpl_mod_href( 'views/submissionslist.php', 'id', $id, 'showgrades', 1 ) );
     }
 } else {
     vpl_inmediate_redirect( vpl_mod_href( 'view.php', 'id', $id ) );
diff --git a/locallib.php b/locallib.php
index 33fb15fe1afbfd4ee3448432c515a0c968fdc938..f5ca0a0a95c16562de43b22b38b5709433fabeea 100644
--- a/locallib.php
+++ b/locallib.php
@@ -334,8 +334,7 @@ function vpl_url_add_param($url, $parm, $value) {
  */
 function vpl_redirect($link, $message, $type = 'info', $errorcode='') {
     global $OUTPUT;
-    global $CFG;
-    if (! mod_vpl::header_is_out()) {
+    if (!$OUTPUT->has_started()) {
         echo $OUTPUT->header();
     }
     echo $OUTPUT->notification($message, $type);
@@ -351,19 +350,7 @@ function vpl_redirect($link, $message, $type = 'info', $errorcode='') {
  * @return void
  */
 function vpl_inmediate_redirect($url) {
-    global $OUTPUT;
-    if (! mod_vpl::header_is_out()) {
-        echo $OUTPUT->header();
-    }
-    static $idcount = 0;
-    $idcount ++;
-    $text = '<div class="continuebutton"><a id="vpl_red' . $idcount . '" href="';
-    $text .= $url. '">' . get_string( 'continue' ) . '</a></div>';
-    $deco = urldecode( $url);
-    $deco = html_entity_decode( $deco );
-    echo vpl_include_js( 'window.location.replace("' . $deco . '");' );
-    echo $text;
-    echo $OUTPUT->footer();
+    echo vpl_include_js( 'window.location.replace("' . html_entity_decode(urldecode($url)) . '");' );
     die();
 }
 /**
@@ -886,11 +873,10 @@ function vpl_get_webservice_token($vpl) {
         return '';
     }
     $tokenrecord = $DB->get_record( 'external_tokens', array (
-            'sid' => session_id(),
             'userid' => $USER->id,
             'externalserviceid' => $service->id
     ) );
-    if (! empty( $tokenrecord ) and $tokenrecord->validuntil < $now) {
+    if (! empty( $tokenrecord ) and $tokenrecord->validuntil > 0 and $tokenrecord->validuntil < $now) {
         unset( $tokenrecord ); // Will be delete before creating a new one.
     }
     if (empty( $tokenrecord )) {
@@ -933,7 +919,7 @@ function vpl_get_webservice_urlbase($vpl) {
     if ($token == '') {
         return '';
     }
-    return $CFG->wwwroot . '/mod/vpl/webservice.php?moodlewsrestformat=json'
+    return $CFG->wwwroot . '/webservice/rest/server.php?moodlewsrestformat=json'
            . '&wstoken=' . $token . '&id=' . $vpl->get_course_module()->id . '&wsfunction=';
 }
 
diff --git a/vpl.class.php b/vpl.class.php
index 8f5ce0f90d2f84d58e947588fa27da922fcdada6..918e4d426abd0bbb07a1db24b5bc8f76541da98d 100644
--- a/vpl.class.php
+++ b/vpl.class.php
@@ -1068,7 +1068,15 @@ class mod_vpl {
     public function user_picture($user) {
         global $OUTPUT;
         if ($this->is_group_activity()) {
-            return print_group_picture( $this->get_usergroup( $user->id ), $this->get_course()->id, false, true );
+            $group = $this->get_usergroup( $user->id );
+            $picture = print_group_picture( $group, $this->get_course()->id, false, true );
+            if (!$picture) {
+                $url = vpl_abs_href( '/group/overview.php', 'id', $this->get_course()->id, 'group', $group->id);
+                $picture = '<a href="' . $url . '" style="color: initial;">' .
+                               $OUTPUT->render(new pix_icon('group', '', 'mod_vpl')) .
+                           '</a>';
+            }
+            return $picture;
         } else {
             $options = array('courseid' => $this->get_instance()->course, 'link' => ! $this->use_seb());
             return $OUTPUT->user_picture( $user, $options);
@@ -1089,7 +1097,7 @@ class mod_vpl {
             $group = $this->get_usergroup( $user->id );
             if ($group !== false) {
                 if ($withlink) {
-                    $url = vpl_abs_href( '/user/index.php', 'id', $this->get_course()->id, 'group', $group->id );
+                    $url = vpl_abs_href( '/group/overview.php', 'id', $this->get_course()->id, 'group', $group->id);
                     return '<a href="' . $url . '">' . $group->name . '</a>';
                 } else {
                     return $group->name;
@@ -1778,7 +1786,7 @@ class mod_vpl {
                 $this->print_restriction( 'automaticgrading', $noyes [1], false, false );
             }
             if ($instance->maxexetime) {
-                $this->print_restriction( 'maxexetime', $instance->maxexetime . ' s', false, false );
+                $this->print_restriction( 'maxexetime', format_time($instance->maxexetime), false, false );
             }
             if ($instance->maxexememory) {
                 $this->print_restriction( 'maxexememory', vpl_conv_size_to_string( $instance->maxexememory ), false, false );