update find first element function