Motion detection, fixed lock issue