Thanks for the comments, the issue is in recovering the elements to be able to leave (my English is not very good, the same I am wrong ).