fixed and improved unit tests