fixed dynamic cast issue