Fixed StackoverFlow bug