Without knowing what the "and all" is in how you did the test, I can't say why your shots weren't as sharp.
I don't have a problem with sharpenss with mine. And places like photozone.de rate it at 4.36 out of 5 for sharpness. The 18-55 is rated at 0.61.
So either you didn't do your testing right or you got a bad 17-40.