[Fixes #1] bug reported 

As discussed here: https://moodle.org/mod/forum/discuss.php?d=92548#p999420