The code that I added should only skip over the server behavior if there are no items with a weight in the cart. If you are getting an error it means that the server behavior is being triggered so it seems that there might be another issue occurring in the server behavior. Have you tried this out with a few different items by themselves and together to see if you get this same result?
If you are getting it regularly then you should add in the USPS full request and full response to your failure page that you are getting to. These should be available to you in the bindings tab, just drag and drop them onto the page. If you have any trouble with the info that you get post back with the details so we can look into it with you.