fixed resource leak