Motion detection bug corrected