I fixed my mistake (which I didn't know about because you said it "worked perfectly"). The code has been updated in the original post.
P.S. In the future, when I ask for examples, it would be appreciated if you could give actual examples that you would actually use in the server. Sometimes, this can help rule out other issues. Because you told me it worked, I didn't know at the time that was a coding issue.