Fixed stackoverflow error. Phew!