Remove custom post type slug

This is a tricky one, I had exactly the same problem but after a lot of debugging and troubleshooting I managed to fix it.

The trick is to add a new rewrite rule:

function book_rewrite_rule() {
    add_rewrite_rule( '(.*?)$', 'index.php?book=$matches[1]', 'top' );
}
add_action( 'after_theme_setup', 'book_rewrite_rule' );