Fix various bug