Fixes and Last Viewed feature

Moodle 2.4+
https://tracker.moodle.org/browse/MDL-34472