As a temp fix while waiting I installed WP-PageNavi Plugin.

Then in the loop-ad.php file I found the following line (around line 56)

<?php endwhile; ?>
<?php...