Fixing StackOverflow bugs