fix minor bug in parse algorithm