unit tests an bug fixes