change namespace and fix a few bugs