fixed stackoverflow error