Fixed resource leak