Post your SubMain() code so we can have a look...