Correct even more memory leaks
Small refactor