Fix for possible resource leak.