Bug fixes

Fixed issues related to using valid = no in the result() function and
toxml()