fix a possible undefined variable in bayeux
more robust error handling in MongoDB logger