fix needed in case of recursion

see comments