Fix memory leak, broken assertion