Several bug fixed