fix #48 and more...

all tests are passing.