fix idle logic