fixed bad recursion