Fixed a crash when changing the sorting order of books.