Fixed the too much recursion bug