added protection against out of books or too many books