Actually, now that I see the rest of the code, you mayaswell just drop this and modify HTTPDirectory to use monthNum directly.  Then, if you have monthNum=0 and month, convert month to monthNum.