Fixed a test and code-cleanup