Fixes bug in setting error message.