Fixed logical error in parsing