fixed parsing of malformed URLs