remove temporary debug print and add configurable debug print.
fix bug.