From what you've shown here, I don't see any reason why it shouldn't work. Maybe you should show your real code?