improved timer accuracy and fixed warning