some tests, fixes and docs