fixed bug: stack overflow