Fixed small bug in parsing algorithm