bugfix: debug argument didn't work
add debug lines
add unittest file and test