Print debug messages only in debug mode.  Closes #779