add --enable-debug to configure.ac and fix some tiny bugs