fix incorrect page number for the last page in onSave (closes #6)