pop instead of delete to update array length