fix bug to avoid exception occurred.