bug fixes and added initial tests.
config fix