fixing some arrangement in the error display logic