Fix possible StackOverflowExceptions