Fixing a problem with illegal offsets with wrong orderby clauses.

Signed-off-by: Ronald Huereca <ronalfy@gmail.com>