fix infinite loop bug in output of m command.
add error codes to syntax error to help track down bugs.