fixed resource lock bug