custom permalinks for custom post type


i have custom post type: book
taxonomy: booktype
i created: ebook as parent category of comedy, both are created from booktype taxomony

so i need the permalink structure like this:

I used custompress + custom post permalink but it doesn't work

If i check ebook and comedy categories, url works like this
and if i dont check ebook category. 404 error

How to solve this? i want to keep ebook and comedy checked without 404 error