Fix for https://github.com/jhy/jsoup/issues/504