Fixed some bugs in parseValue().