expanded unit tests, bug fixes