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. This should be fixed ASAP.