Fixed wrong order of "UNION" and "ORDER BY"

If you use UNION with ORDER BY, UNION is needed first and after that ORDER BY to sort the result.