fix a few bugs including logging and add gui tester