Added some error checking for the get_terms for first and last chapter navigation buttons