Fix bug in parsing and parse in a more efficient way