Catch exceptions while waiting for messages.
Remove redundant brackets.