Fixed logic bug in parsing function.