Fix logic error in URL splitting code