diff --git a/locallib.php b/locallib.php
index b1d86354d7b37db94b5c08280f2943109f7167b9..ed83be8aa9b3259308c86c79ef225d0c3c14955a 100644
--- a/locallib.php
+++ b/locallib.php
@@ -508,7 +508,7 @@ function pdfannotator_get_datetime_of_last_modification($annotatorid) {
     $timemodified = $timemodified->timemodified;
 
     // 2. When was the last time an annotation or a comment was added in the specified annotator?
-    $sql = "SELECT max(a.timecreated) as 'last_annotation', max(c.timemodified) as 'last_comment' "
+    $sql = "SELECT max(a.timecreated) as ".'"last_annotation"'." , max(c.timemodified) as ".'"last_comment"'." "
             . "FROM {pdfannotator_annotations} a LEFT OUTER JOIN {pdfannotator_comments} c ON a.id = c.annotationid "
             . "WHERE a.pdfannotatorid = ?";
     $newposts = $DB->get_records_sql($sql, array($annotatorid));