added unit tests (and fixes) for new features