Fix incorrect error message displaying.