Bug fix

Fixed a bug where timer is not correctly ended