Some parsing bugs from the input fixed