Fix bug which sometimes happened