Help with Plugin to AutoPopulate Excerpt with Content on CPT

I am writing a plugin to auto-populate excerpt field on Woothemes Sensei Lesson CPT with text inside shortcodes placed on the content area. My goal is to remove shortcodes and some unwanted text.

It is working fine for lessons CPT, but...on posts and pages, it disables "publish" button, substituting it for "send to review". I don't know why, but it is no good at all.

Current code:

if ( ! defined( 'ABSPATH' ) ) exit;

    //Function to prepare excerpt

    function mltrib_prepare_excerpt($excerpt) {

//Execute shortcode on the excerpt
    $excerpt = do_shortcode($excerpt);
//Removing HTML tags generated by shortcode
    $excerpt = strip_tags($excerpt);
//Removing unwanted strings, shortcode not executed and empty lines
    $excerpt = str_replace(array('Toggle', 'Title', 'Envie suas transcrições para nós. Saiba mais aqui.', '[ninja_forms_display_form id=1]', ' '), '', $excerpt);
//Trimming words, allowing only 100, followed by "..."
    $excerpt = wp_trim_words($excerpt, 100);
//Returning result
    return $excerpt;

}

add_filter( 'wp_insert_post_data', 'mltrib_populate_excerpt', 99, 2 );

/**
 * Checks if the the post field "excerpt" was filled or not. If not, using "content" to fill it.
 * Code reference: http://wordpress.stackexchange.com/a/52897/12615
 */

function mltrib_populate_excerpt( $data, $postarr ) {
// check if it's a valid call
//    if ( !in_array( $data['post_status'], array( 'draft', 'pending', 'auto-draft' ) ) && 'lesson' == $data['post_type'] ) 

// Checking if it is a "lesson" post type
    if ( 'lesson' == $data['post_type'] )
    {
// if the excerpt is empty, call the excerpt creation function
        if ( strlen($data['post_excerpt']) == 0 ) {

// using prepare excerpt function
    $data['post_excerpt'] = mltrib_prepare_excerpt($data['post_content']);

        }

    return $data;
    }
}?>

I was thinking if the problem may be related to the add_filter, so I tried adding it only on Lesson CPT, with this:

add_action('wp', 'mltrib_islesson');

    function mltrib_islesson() {
        if ('lesson' == get_post_type()) {

            add_filter( 'wp_insert_post_data', 'mltrib_populate_excerpt', 99, 2 );          

        }

    }

But with this the plugin won't work on lesson CPT.

So, I am clueless. Any guess?

Thanks

Luis Rock