fix possible StackOverflowError