fix resouce bug