Fix leaking resource