Correctly print/dump "nil".

  This updates msg() to write "nil" appropriately, and similarly
 we handle this case for dump_stack.