Fix bug with StackOverflow