Added namespace tests and some bug fixes