Chaining bug for order_by

For now, I just added more unit tests (one of them shows the problem). I'll try to fix it soon, but I haven't identified the problem yet. Go ahead and commit in this branch, as this should be fixed ASAP.