Fix typo.
Avoids memory leak.
+ Adds new tests.