fixed bugs related to equation parsing