From Stephan Huber, fixed bug in setting _numMessagesPerEvent and added more debug information