Fixes JS incase last page is the second page