Implement message queue ordering test and fix compilation errors