Fix some memory leaks

Also added some Tag.create tests to be sure I didn't break something