Fixed stackoverflow exception