fix logic in books.php