Fix start and stop detection