#554 Fix memory leak