Problem with positioning mc with loaded picture inside

Hello everyone, I really hope You will be able to help me, cause I’m stucked.

This is a webpage, where I use a modified gallery from kirupa.com tutorial (xml galllery with thumbs).

This place is where I align picture movieclip in the center of area (which is also a mask).
Sometimes, action clip doesn’t get image _width and _height and load a picture with it’s left upper corner in the center of mask movieclip. When I click again on thumbnail - image loads already perfectly how it should be centered. What can be the problem? maybe I missed something?

Here is a modified code of the gallery:

stop();

function loadXML(loaded) {
	if (loaded) {
		xmlNode = this.firstChild;
		image = [];
		thumbnails = [];
		preview = [];
		booktitle = [];
		author = [];
		forlag = [];
		isbn = [];
		omfang = [];
		matt = [];
		omslag = [];
		utgivning = [];
		pdf = [];
		total = xmlNode.childNodes.length;
		for (i=0; i<total; i++) {
			image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
			thumbnails* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
			preview* = xmlNode.childNodes*.childNodes[2].firstChild.nodeValue;
			booktitle* = xmlNode.childNodes*.childNodes[3].firstChild.nodeValue;
			author* = xmlNode.childNodes*.childNodes[4].firstChild.nodeValue;
			forlag* = xmlNode.childNodes*.childNodes[5].firstChild.nodeValue;
			isbn* = xmlNode.childNodes*.childNodes[6].firstChild.nodeValue;
			omfang* = xmlNode.childNodes*.childNodes[7].firstChild.nodeValue;
			matt* = xmlNode.childNodes*.childNodes[8].firstChild.nodeValue;
			omslag* = xmlNode.childNodes*.childNodes[9].firstChild.nodeValue;
			utgivning* = xmlNode.childNodes*.childNodes[10].firstChild.nodeValue;
			pdf* = xmlNode.childNodes*.childNodes[11].firstChild.nodeValue;
			thumbnails_fn(i);
		}
		firstImage();
	} else {
		content = "file not loaded!";
	}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("bocker.xml");
///////////////////////////////////// 
listen = new Object();
listen.onKeyDown = function() {
	if (Key.getCode() == Key.LEFT) {
		prevImage();
	} else if (Key.getCode() == Key.RIGHT) {
		nextImage();
	}
};
Key.addListener(listen);
p_btn.onRelease = function() {
	prevImage();
};
n_btn.onRelease = function() {
	nextImage();
};
///////////////////////////////////// 
p = 0;

this.onEnterFrame = function() {
	filesize = picture.getBytesTotal();
	loaded = picture.getBytesLoaded();
	preloader._visible = true;
	if (loaded != filesize) {
		preloader.gotoAndStop(int(100*loaded/filesize));
	} else {
		preloader._visible = false;
		if (picture._alpha<100) {
			picture._alpha += 10;
		}
	}
};
function nextImage() {
	if (p<(total-1)) {
		p++;
		if (loaded == filesize) {
			picture._alpha = 0;
			picture.loadMovie(image[p], 1);
			booktitle_txt.text = booktitle[p];
			author_txt.text = author[p];
			forlag_txt.text = forlag[p];
			isbn_txt.text = isbn[p];
			omfang_txt.text = omfang[p];
			matt_txt.text = matt[p];
			omslag_txt.text = omslag[p];
			utgivning_txt.text = utgivning[p];
			pdf_txt = pdf[p];
			pdf_btn.onRelease = function() {
			getURL(pdf_txt, '_blank');
		};
			picture_num();
		}
	}
}
function prevImage() {
	if (p>0) {
		p--;
		picture._alpha = 0;
		picture.loadMovie(image[p], 1);
		booktitle_txt.text = booktitle[p];
		author_txt.text = author[p];
		forlag_txt.text = forlag[p];
		isbn_txt.text = isbn[p];
		omfang_txt.text = omfang[p];
		matt_txt.text = matt[p];
		omslag_txt.text = omslag[p];
		utgivning_txt.text = utgivning[p];
		pdf_txt = pdf[p];		
		pdf_btn.onRelease = function() {
			getURL(pdf_txt, '_blank');
		};
		picture_num();
	}
}
function firstImage() {
	p=0;
	if (loaded == filesize) {
		picture.loadMovie(image[0], 1);
		picture._alpha = 0;
		booktitle_txt.text = booktitle[p];
		author_txt.text = author[p];
		forlag_txt.text = forlag[p];
		isbn_txt.text = isbn[p];
		omfang_txt.text = omfang[p];
		matt_txt.text = matt[p];
		omslag_txt.text = omslag[p];
		utgivning_txt.text = utgivning[p];
		pdf_txt = pdf[p];
		pdf_btn.onRelease = function() {
			getURL(pdf_txt, '_blank');
		};
		picture_num();
	}
}
function picture_num() {
	align_mc();
	current_pos = p+1;
	pos_txt.text = current_pos+" / "+total;
			n_btn._x = picture._x + picture._width;
			n_btn._y = area._y + (area._height / 2);
			p_btn._x = picture._x;
			p_btn._y = area._y + (area._height / 2);
			picture._x = area._x + (area._width / 2) - (picture._width / 2);
			picture._y = area._y + (area._height / 2) - (picture._height / 2);
			preloader._x = area._x + (area._width/2) - 180;
	//xcor_txt.text = picture._x; - used those to check out coordinates of a pictures
	//ycor_txt.text = picture._y; - used those to check out coordinates of a pictures
	//width_txt.text = picture._width; - used those to check out width of a pictures
	//height_txt.text = picture._height; - used those to check out height of a pictures
}

Here is also some pictures, of how it looks like, if you don’t see that in web:

This is when when movie loads image into picture movieclip:

And after I click again on the first thumbnail

Please, help me guys, I’m trying to fix that bug for already two days and still have had no result.