Attempt to fix undefined first element in tree