rm some logging and fixed some bugs and added a test