fixed stackoverflow issue