Fix sql exception is not clean bug