added cleanup support for non built-in types