Plugin bug fixes and unit tests.