Problem retrieving transform.position after parent rotation

Hello,
I am trying to make a Tetris clone to practice a bit but I stumbled upon a problem I can’t resolve.
I spawn a brick, for example the L shaped one,made from gameobjects representing each one piece of the brick. I make a piece the parent of all the other pieces in order to rotate the brick around this piece with a simple transform.roation. When I rotate it everything looks fine, but when I try to move it, so I go and check if the brick can move, transform.position for one of the child gets me the wrong value, giving me a free position as a position occupied by that piece. This only happens when trying to move on the field with the x value equal to 0. My tetris field where i can move the bricks is 10 positions in width and 20 positions in height. Its seems to me as if transform.position is returning me the local value insted of the gobal when i check for positions with the x = 0.

The code that follows is how i check and move the brick, with brick[0] the parent of the other pieces. I rotate the brick with a simple

brick [0].transform.Rotate (0f, 0f, 90f); …

void MoveBrick(int xDirection){

	foreach (GameObject bri in brick) {
		int newPosX =(int) bri.transform.position.x + xDirection;
		int newPosY = (int)bri.transform.position.y;
		if (newPosX < 0 || newPosX >= columns)
			return;
		if (newPosY<rows&&placeTaken [newPosX-originX, newPosY-originY])
			return;
	}

	brick [0].transform.position = new Vector3 (brick [0].transform.position.x +xDirection, brick [0].transform.position.y);
}

I fixed it… the problem was in the conversion from float to int… putting

int newPosY = (int) Math.Round(bri.transform.position.y);

fixed my problem