better url parsing, safer error handling on no content