debbug logical mistakes on parser