fix potentional bugs