Partial fix for bug #4581 Some links in query_result doesn't work