bug fixing in tries insertion