small cleanup
add testcase, up coverage