doc and bug fixes