apply @knownasilya's first slide detection fix to dev branch #671