 			freeWidthSpace = 0
 
 	if not autoHeight
-		freeHeightSpace = (effectItem._height - rowSpacing * lastRow - topPadding - bottomPadding) - gridHeight
+		freeHeightSpace = effectItem._height - rowSpacing * lastRow - topPadding - bottomPadding - gridHeight
 		if freeHeightSpace > 0 and rowsFillsSum > 0
 			unusedFills = getCleanArray unusedFills, lastRow+1
 			length = lastRow+1

		i++

	# get grid size
	if autoWidth or columnsFillsSum > 0 or alignH isnt 0
		gridWidth = 0
		for i in [0..lastColumn] by 1
			gridWidth += columnsSizes[i]

	if autoHeight or rowsFillsSum > 0 or alignV isnt 0
		gridHeight = 0
		for i in [0..lastRow] by 1
			gridHeight += rowsSizes[i]

	# expand filled cells
	if not autoWidth
		freeWidthSpace = (effectItem._width - columnSpacing * lastColumn - leftPadding - rightPadding) - gridWidth
		if freeWidthSpace > 0 and columnsFillsSum > 0
			unusedFills = getCleanArray unusedFills, lastColumn+1
			length = lastColumn+1

exports.DATA =
	pending: false
	updatePending: false
	gridType: 0
	gridUpdateLoops: 0
	autoWidth: true
