various bug fixes in the parsing code

Signed-off-by: dvorkinista <villain@noironetworks.com>