Fixing typos and adding proper garbage collection to tests