I don't immediately see any problem, but I'm willing to bet the error is actually somewhere above this snippet of code.