remove unused code and check chroot_lock before release