problem with recursion fixed