Added unit tests for prior bugfixes