use splice to remove array element instead of delete