fix error statement order