fixed the "diagram on the last page" bug
Merge origin/master