Bug fix; some unit tests updated