update_count bug that occured when counter go less than 0 is fixed
refacto some code