I've been trying to create a Recent Post widget where it only show/display posts that have both categories X and Y (or more). The categories X and Y is user-defined, so I'm planning to make it look like this:

In fact, that picture is an actual screenshot from what I have managed to create.
It is working fine if I select only from one category. It would show all posts which have the category of X (or X's children). However, if I add one more category, it would stop working--instead, the widget would show all recent posts regardless of categories.

For creating this code, basically I copied the widget_recent_posts class from default-widget.php and add a field for ID input. It utilizes WP_query to query the posts and category__and to select the post:
$r = new WP_Query( apply_filters( 'widget_posts_args', array( 'posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'category__and' => array($category_name), 'ignore_sticky_posts' => true ) ) );
What I have created so far (the full class) is available here: http://codepad.org/yf1ZFAt5
I'd be really thankful if anyone could hep me, as I have been messing around with this one for hours but haven't managed to tackle it. :s