fixed: recursive function wrongly called several time