Various bug fixes

Some improvements and bug fixes:

* Event sorting
* Fix large binary data handling
* Fix command bus client
* Avoid using 0 when null is passed to commands with Number arguments
* Add the capability to choose the order in which the events are returned