fixed issue with books count query