Fixed stack overflow