fixed lock/flag reset [ci skip]