Fix for issue #8: added checks for message levels