additional tests and bug fixes