Bug Fixes and Unit Tests