If you are in H1b more than 183 days for year 2004, you pay tax for the full year as resident. Otherwise, you pay tax as resident for the days you are in H1b. The treaty you talk about only applies to J1.