Substituting variables to name fails in Numbers application

Can anyone tell me why the second stNmbrs(thNm, bnds1, bnds2) script does not work when the first one does?
Thanks

set thNm to "Numbers"
set bnds1 to {0, 64, 400, 600}
set bnds2 to {420, 64, 820, 600}
stNmbrs(thNm, bnds1, bnds2)

on stNmbrs(thNm, bnds1, bnds2)
	-- gets win specs, returns nothing
	tell application thNm
		activate
		set wCnt to count (the windows of application "Numbers" whose visible is true)
		tell application "System Events"
			repeat (2 - wCnt) times
				keystroke "n" using command down
				delay 0.2
			end repeat
			set bounds of (window 1 of application "Numbers") to bnds1
			set bounds of (window 2 of application "Numbers") to bnds2
		end tell
	end tell
end stNmbrs

on stNmbrs(thNm, bnds1, bnds2)
	-- gets win specs, returns nothing
	tell application thNm
		activate
		set wCnt to count (the windows of application thNm whose visible is true)
		tell application "System Events"
			repeat (2 - wCnt) times
				keystroke "n" using command down
				delay 0.2
			end repeat
			set bounds of (window 1 of application thNm) to bnds1
			set bounds of (window 2 of application thNm) to bnds2
		end tell
	end tell
end stNmbrs

My guess is that the statement is too complex for the compiler to realize. As your command is already directed to the application, the second app call is unnecessary.

on stNmbrs(thNm, bnds1, bnds2)
tell application thNm to set wCnt to count (windows whose visible is true)
end

Thanks for that.
In the meanwhile I made it work like this:

on stNmbrs(thNm, bnds1, bnds2)
	tell application thNm
		activate
		set wCnt to (count documents)
		repeat 2 - wCnt times
			tell application "System Events" to tell (first process whose title is thNm) to tell menu bar 1 to tell menu bar item 3 to tell menu 1 to click menu item 1
		end repeat
		set bounds of window 1 to bnds1
		set bounds of window 2 to bnds2
	end tell
end stNmbrs